<template>
  <view class="box">
    <view class="tou top" :style="'padding-top:' + statusBarHeight1 + 'px'">
      <image
        @click="fanhui"
        class="image1"
        src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png"
      />经纪人认证
    </view>
    <scroll-view scroll-y class="scroll-view" :refresher-enabled="false">
      <form>
        <view class="cu-form-group">
          <view class="title"> <span style="color: red">*</span>姓名 </view>
          <input
            type="text"
            v-model="userName"
            placeholder="请填写姓名"
            :disabled="status == 1 ? false : true"
          />
        </view>
        <view class="cu-form-group">
          <view class="title"> <span style="color: red">*</span>联系方式 </view>
          <input type="text" v-model="phone" placeholder="请填写联系方式" disabled />
        </view>
        <view class="cu-form-group" >
          <view class="title"> <span style="color: red">*</span>所属门店 </view>
          <input type="text" v-model="shopName" placeholder="请选择门店" disabled />
          <text
            @click="mendian"
            class="cuIcon-search text-orange"
            style="color: #64b6a8"
            v-if="status == 1"
          ></text>
        </view>
        <!-- <view class="cu-form-group">
		    <view class="title">
		      <span style="color: red">*</span>头像
		    </view>
		  </view>
		  <view class="shangchuan">
		    <view class="cu-form-group">
		      <view class="grid col-4 grid-square flex-sub">
		        <view class="bg-img" v-for="(item, index) in imgList" :key="index" @tap="ViewImage"
		          :data-url="imgList[index]">
		          <image :src="imgUrl + imgList[index]" mode="aspectFit" />
		          <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index" v-if="status == 1">
		            <text class="cuIcon-close"></text>
		          </view>
		        </view>
		        <view class="solids" @tap="ChooseImages(0)" v-if="imgList.length < 1">
		          <text class="cuIcon-cameraadd"></text>
		        </view>
		      </view>
		    </view>
		    <view style="
		        font-size: 24rpx;
		        color: #999999;
		        background-color: #fff;
		        padding-left: 40rpx;
		      ">
		      上传要求清晰、健康、代表品牌形象
		      <p style="margin-top: 10rpx">请勿使用二维码，最大5mb，200*200像素</p>
		    </view>
		  </view> -->
        <!-- <view class="cu-form-group">
		    <view class="title">
		      <span style="color: red">*</span>名片
		    </view>
		  </view>
		  <view class="shangchuan">
		    <view class="cu-form-group">
		      <view class="grid col-4 grid-square flex-sub">
		        <view class="bg-img" v-for="(item, index) in imgList1" :key="index" @tap="ViewImage1"
		          :data-url="imgList1[index]">
		          <image :src="imgUrl + imgList1[index]" mode="aspectFit" />
		          <view class="cu-tag bg-red" @tap.stop="DelImg1" :data-index="index" v-if="status == 1">
		            <text class="cuIcon-close"></text>
		          </view>
		        </view>
		        <view class="solids" @tap="ChooseImages(1)" v-if="imgList1.length < 1">
		          <text class="cuIcon-cameraadd"></text>
		        </view>
		      </view>
		    </view>
		    <view style="
		        font-size: 24rpx;
		        color: #999999;
		        background-color: #fff;
		        padding-left: 40rpx;
		      ">
		      上传要求清晰、健康、代表品牌形象
		      <p style="margin-top: 10rpx">请勿使用二维码，最大5mb，200*200像素</p>
		    </view>
		  </view> -->
        <!-- <view class="cu-form-group">
		    <view class="title">
		      <span style="color: red">*</span>营业执照
		    </view>
		  </view>
		  <view class="shangchuan">
		    <view class="cu-form-group">
		      <view class="grid col-4 grid-square flex-sub">
		        <view class="bg-img" v-for="(item, index) in imgList2" :key="index" @tap="ViewImage2"
		          :data-url="imgList2[index]">
		          <image :src="imgUrl + imgList2[index]" mode="aspectFit" />
		          <view class="cu-tag bg-red" @tap.stop="DelImg2" :data-index="index" v-if="status == 1">
		            <text class="cuIcon-close"></text>
		          </view>
		        </view>
		        <view class="solids" @tap="ChooseImages(2)" v-if="imgList2.length < 1">
		          <text class="cuIcon-cameraadd"></text>
		        </view>
		      </view>
		    </view>
		    <view style="
		        font-size: 24rpx;
		        color: #999999;
		        background-color: #fff;
		        padding-left: 40rpx;
		      ">上传要求信息清晰、最大2mb</view>
		  </view> -->
        <view class="cu-form-group">
          <view class="title"> <span style="color: red">*</span>身份证（人像面） </view>
        </view>
        <view class="sfz">
          <view class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view
                class="bg-img id_card"
                v-for="(item, index) in imgList3"
                :key="index"
                @tap="ViewImage3"
                :data-url="imgList3[index]"
              >
                <image :src="imgUrl + imgList3[index]" mode="aspectFit" />
                <view
                  class="cu-tag bg-red"
                  @tap.stop="DelImg3"
                  :data-index="index"
                  v-if="status == 1"
                >
                  <text class="cuIcon-close"></text>
                </view>
              </view>
              <view class="solids id_card" @tap="ChooseImages(3)" v-if="imgList3.length < 1">
                <img
                  style="width: 100%; height: 100%"
                  src="https://pic.bangbangtongcheng.com/static/sfzgr_f.png"
                  alt
                />
              </view>
            </view>
          </view>
        </view>

        <view class="cu-form-group">
          <view class="title"> <span style="color: red">*</span>身份证（国徽面） </view>
        </view>
        <view class="sfz">
          <view class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view
                class="bg-img id_card"
                v-for="(item, index) in imgList4"
                :key="index"
                @tap="ViewImage4"
                :data-url="imgList4[index]"
              >
                <image :src="imgUrl + imgList4[index]" mode="aspectFit" />
                <view
                  class="cu-tag bg-red"
                  @tap.stop="DelImg4"
                  :data-index="index"
                  v-if="status == 1"
                >
                  <text class="cuIcon-close"></text>
                </view>
              </view>
              <view class="solids id_card" @tap="ChooseImages(4)" v-if="imgList4.length < 1">
                <img
                  style="width: 100%; height: 100%"
                  src="https://pic.bangbangtongcheng.com/static/sfzgr_z.png"
                  alt
                />
              </view>
            </view>
          </view>
        </view>
      </form>
    </scroll-view>
    <view class="tijiao">
      <view class="but" @click="submit" v-if="status == 1">提交审核</view>
      <!-- <view class="but" @click="confirmDuty" v-if="confirmDuty == 1">确认离职</view> -->
      <view class="but" v-if="status == 0">店铺审核中</view>
      <view class="but" v-if="status == 2">平台审核中</view>
    </view>
    <uniBall></uniBall>
    <view class="toast" v-if="showToast">
      {{ toastMsg }}
    </view>
  </view>
</template>
<script>
  import permision from '@/js_sdk/wa-permission/permission.js'
  //#ifdef H5
  import wxshare from '../utils/index.js'
  //#endif
  import { mapGetters } from 'vuex'
  export default {
    components: {},
    data() {
      return {
        type: 1,
        isselect: 0,
        showToast: false,
        toastMsg: '经纪人认证提交成功，请等待商家审核→后台审核',
        ceng: false,
        video: '',
        xiaoq: '',
        // imgList: [],
        // imgList1: [],
        // imgList2: [],
        imgList3: [],
        imgList4: [],
        upload3:false,
        upload4:false,
        index: -1,
        picker: ['喵喵喵', '汪汪汪', '哼唧哼唧'],
        id: '',
        shopId: '',
        shopName: '',
        userName: '',
        phone: '',
        image: '',
        businessCard: '',
        businessLicense: '',
        idCardUp: '',
        idCardDown: '',
        dutyStatus: '',
        status: 1,
        jjPerson: '',
        confirmDuty: '',
        userInfo: uni.getStorageSync('Pduser'),
        imgUrl: this.$imgSrc,
        anti_shake: false,
      }
    },
    computed: {
      ...mapGetters(['userid', 'islogin', 'statusBarHeight1', 'userinfo']),
    },
    onShow: function (e) {
      // let pages = getCurrentPages();
      // let currPage = pages[pages.length - 1];
      // if (currPage.data.shopId != "") {
      //   this.shopId = currPage.data.shopId;
      //   this.shopName = currPage.data.shopName;
      // }
    },
    onPullDownRefresh() {
      uni.stopPullDownRefresh()
    },
    onLoad() {
      if (this.userInfo.shopId) {
        this.shopId = this.userInfo.shopId
        this.isselect = '1'
      }
      this.phone = this.userInfo.phone
      this.init()
      /* #ifdef H5 */
      this.jinzhi()
      /* #endif */
    },
    methods: {
      mendian() {
        uni.navigateTo({
          url: '/pages_my/shop',
        })
      },
      fanhui() {
        uni.navigateBack({
          delta: 1,
        })
      },
      init() {
        let that = this
        // that.imgList = [];
        // that.imgList1 = [];
        // that.imgList2 = [];
        that.imgList3 = []
        that.imgList4 = []
        this.$myRequest
          .get('/mob/user/getAgentInfoByUserIdIsQuit', {
            userId: that.userInfo.id,
          })
          .then((res) => {
            //未申请
            if (res.IsExistence) {
              this.status = 1
              //之前已申请 未离职
            } else if (!res.IsExistence && res.agentInfo.isQuit == 'false') {
              console.log(111)
              that.id = res.agentInfo.id
              that.userName = res.agentInfo.userName
              that.shopId = res.agentInfo.shopId
              that.shopName = res.agentInfo.shopName
              that.status = res.agentInfo.status
              that.jjPerson = res.agentInfo.jjPerson
              that.dutyStatus = res.agentInfo.dutyStatus

              // that.imgList.push(res.agentInfo.image);
              // that.imgList1.push(res.agentInfo.businessCard);
              // that.imgList2.push(res.agentInfo.businessLicense);
              that.imgList3.push(res.agentInfo.idCardUp)
              that.imgList4.push(res.agentInfo.idCardDown)
              //之前已申请 已离职
            } else if (!res.IsExistence && res.agentInfo.isQuit == 'true') {
              console.log(222)
              // that.id = res.agentInfo.id;
              that.userName = res.agentInfo.userName
              // that.shopId = res.agentInfo.shopId;
              // that.shopName = res.agentInfo.shopName;
              that.jjPerson = res.agentInfo.jjPerson
              // that.imgList.push(res.agentInfo.image);
              // ///////////////////////////
              // that.imgList1.push(res.agentInfo.businessCard);
              // that.imgList2.push(res.agentInfo.businessLicense);
              that.imgList3.push(res.agentInfo.idCardUp)
              that.imgList4.push(res.agentInfo.idCardDown)
              this.status = 1
            }
            //      if(res.hasOwnProperty('agentInfo')){
            // 	that.id = res.agentInfo.id;
            // 	that.userName = res.agentInfo.userName;
            // 	that.shopId = res.agentInfo.shopId;
            // 	that.shopName = res.agentInfo.shopName;
            // 	that.status = res.agentInfo.status;
            // 	that.jjPerson = res.agentInfo.jjPerson;
            // 	that.imgList.push(res.agentInfo.image);
            // 	that.imgList1.push(res.agentInfo.businessCard);
            // 	that.imgList2.push(res.agentInfo.businessLicense);
            // 	that.imgList3.push(res.agentInfo.idCardUp);
            // 	that.imgList4.push(res.agentInfo.idCardDown);
            // }
            console.log(this.status)
          })
      },
      xiaoqu() {
        let _this = this
        uni.request({
          url: 'https://apis.map.qq.com/ws/place/v1/suggestion',
          method: 'get',
          data: {
            keyword: this.xiaoq,
            region: '山东省青岛市平度市',
            region_fix: 1,
            key: 'OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77',
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded',
          },
          success(res) {
            console.log(res)
          },
        })
      },
      ViewImage(e) {
        uni.previewImage({
          urls: this.imgList,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage1(e) {
        uni.previewImage({
          urls: this.imgList1,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage2(e) {
        uni.previewImage({
          urls: this.imgList2,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage3(e) {
        uni.previewImage({
          urls: this.imgList3,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage4(e) {
        uni.previewImage({
          urls: this.imgList4,
          current: e.currentTarget.dataset.url,
        })
      },
      DelImg(e) {
        uni.showModal({
          title: '',
          content: '确定要删除头像？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },

      DelImg1(e) {
        uni.showModal({
          title: '',
          content: '确定要删除名片？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList1.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },
      DelImg2(e) {
        uni.showModal({
          title: '',
          content: '确定要删除营业执照？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList2.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },
      DelImg3(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证人像面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList3.splice(e.currentTarget.dataset.index, 1)
              this.upload3 = false
            }
          },
        })
      },
      DelImg4(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证国徽面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList4.splice(e.currentTarget.dataset.index, 1)
              this.upload4 = false
            }
          },
        })
      },

      async ChooseImages(type) {
		    let that = this
        if (type == 0) {
          that.ChooseImage()
        } else if (type == 1) {
          that.ChooseImage1()
        } else if (type == 2) {
          that.ChooseImage2()
        } else if (type == 3) {
          if(this.upload3){
            return
          }
          that.ChooseImage3()
        } else if (type == 4) {
          if(this.upload4){
            return
          }		
          that.ChooseImage4()
        }
      },
      ChooseImage() {
        let _this = this
        _this.imgList = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = '',resType;
            // #ifdef H5
            length = tempFiles[0].name.length
            resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
        })
      },
      ChooseImage1() {
        let _this = this
        _this.imgList1 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = '',resType;
            // #ifdef H5
            length = tempFiles[0].name.length
            resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList1.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
        })
      },
      ChooseImage2() {
        let _this = this
        _this.imgList2 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = '',resType;
            // #ifdef H5
            length = tempFiles[0].name.length
            resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList2.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
        })
      },
      ChooseImage3() {
        let _this = this
        _this.imgList3 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            _this.upload3 = true
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = '',resType;
            // #ifdef H5
            length = tempFiles[0].name.length
            resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList3.push(JSON.parse(res1.data).data[0].url);
                  
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            console.log(fail);
            this.upload3 = false;
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      ChooseImage4() {
        let _this = this
        _this.imgList4 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            _this.upload4 = true
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = '',resType;
            // #ifdef H5
            length = tempFiles[0].name.length
            resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList4.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },

      jinzhi() {
        let _this = this
        let param = window.location.href.split('#')[0]
        uni.request({
          method: 'post',
          data: {
            url: param,
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded',
          },
          url: 'https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do',
          success(re) {
            _this.jinzhifx(re.data)
          },
        })
      },
      jinzhifx(data) {
        wxshare.config({
          debug: false, //是否打开调试
          appId: data.appId, // 公众号的唯一标识
          timestamp: data.timestamp, // 生成签名的时间戳
          nonceStr: data.nonce, // ，生成签名的随机串
          signature: data.signature, // 签名
          jsApiList: ['hideMenuItems'],
        })
        // 禁止分享
        wxshare.hideMenuItems({
          // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
          menuList: [
            'menuItem:share:appMessage',
            'menuItem:share:timeline',
            'menuItem:share:timeline',
            'menuItem:share:qq',
            'menuItem:favorite',
            'menuItem:share:QZone',
            'menuItem:openWithSafari',
          ],
        })
      },
      // 提交
      submit() {
        let that = this
        let data = {}
        if (this.anti_shake) {
          return false
        }
        var status = true
        if (!that.userid) {
          uni.showToast({
            title: '请先登录',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.userName) {
          uni.showToast({
            title: '请填写姓名',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.shopId) {
          uni.showToast({
            title: '请选择门店',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        // if (that.imgList.length <= 0) {
        //   uni.showToast({
        //     title: "请上传头像",
        //     icon: "none",
        //     mask: true
        //   });
        //   status = false;
        //   return false;
        // }
        // if (that.imgList1.length <= 0) {
        //   uni.showToast({
        //     title: "请上传名片",
        //     icon: "none",
        //     mask: true
        //   });
        //   status = false;
        //   return false;
        // }
        // if (that.imgList2.length <= 0) {
        //   uni.showToast({
        //     title: "请上传营业执照",
        //     icon: "none",
        //     mask: true
        //   });
        //   status = false;
        //   return false;
        // }
        if (that.imgList3.length <= 0) {
          uni.showToast({
            title: '请上传身份证人像面',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (that.imgList4.length <= 0) {
          uni.showToast({
            title: '请上传身份证国徽面',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        data.userId = that.userid
        if (that.dutyStatus != '2') {
          data.id = that.id
        }

        data.shopId = that.shopId
        data.userName = that.userName
        data.phone = that.phone
        // data.image = that.imgList[0];
        // data.businessCard = that.imgList1[0];
        // data.businessLicense = that.imgList2[0];
        data.idCardUp = that.imgList3[0]
        data.idCardDown = that.imgList4[0]
        if (status) {
          this.anti_shake = true
          this.$myRequest.post('/mob/user/saveAgentInfo', data).then((res) => {
            if (res.success && res.code == 200) {
              // uni.showToast({
              //   title: "经纪人认证提交成功，等待后台审核",
              //   icon: "none",
              //   mask: true
              // });
              this.showToast = true
              setTimeout(() => {
                this.anti_shake = false
              }, 500)
              setTimeout(() => {
                this.showToast = false
              }, 2000)
              that.init()
            } else {
              uni.showToast({
                title: res.msg,
                icon: 'none',
                mask: true,
              })
              that.init()
            }
          })
        }
      },
    },
  }
</script>
<style lang="less" scoped>
  .tou {
    position: relative;
    width: 100%;
    text-align: center;
    line-height: 88rpx;
    font-size: 36rpx;
    color: #fff;
    background-color: #64b6a8;
    .image1 {
      position: absolute;
      width: 32rpx;
      height: 32rpx;
      // top: 116rpx;
      left: 30rpx;
    }
  }
</style>
<style lang="less" scoped>
  .scroll-view {
    /* #ifdef MP  */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 22px - 196rpx);
    /* #endif */
    /* #ifdef H5 || APP-PULS */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 196rpx);
    /* #endif */
    /* #ifdef APP  */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 196rpx);
    /* #endif */
  }
  .box {
    padding-bottom: 140rpx;
    background: #fff;
    height: 100vh;
  }

  .tijiao {
    position: fixed;
    width: 100%;
    bottom: 0rpx;
    padding-bottom: 40rpx;
    background-color: #fff;
    z-index: 99;

    checkbox {
      vertical-align: top;
      margin-right: 6rpx;
      margin-left: 40rpx;
    }

    span {
      font-size: 26rpx;
    }

    .but {
      width: 670rpx;
      height: 80rpx;
      background: #64b6a8;
      border-radius: 50rpx;
      font-size: 34rpx;
      text-align: center;
      line-height: 80rpx;
      color: #fff;
      margin-top: 24rpx;
      margin-left: 40rpx;
    }
  }

  .jieshao {
    background-color: #fff;

    .kuang {
      position: relative;
      width: 670rpx;
      min-height: 80rpx;
      margin-left: 40rpx;
      padding-bottom: 40rpx;
      background-color: #fff;
      border: 1px solid #c9c9c9;

      textarea {
        width: 620rpx;
        margin-left: 24rpx;
        margin-top: 14rpx;
        line-height: 50rpx;
        letter-spacing: 2rpx;
      }

      p {
        position: absolute;
        bottom: 20rpx;
        right: 20rpx;
        color: #999999;
      }
    }
  }

  .cu-form-group uni-picker .picker {
    text-align: left;
  }

  .cu-form-group .title {
    font-weight: 600;
    font-size: 34rpx;
  }

  .grid.col-4.grid-square > uni-view {
    width: 212rpx;
    height: 212rpx;
  }

  /* .sfz {
    .grid.col-4.grid-square>uni-view {
      width: 670rpx;
      height: 360rpx;
      border-radius: 10rpx;
    }
  } */

  .sfz .id_card {
    width: 670rpx !important;
    height: 360rpx !important;
    border-radius: 10rpx !important;
    padding-bottom: 0px !important;
  }

  .grid.col-4.grid-square > uni-view:nth-child(3n) {
    margin-right: 0;
  }

  .toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 690rpx;
    height: 113rpx;
    background: #64b6a8;
    text-align: center;
    color: #fff;
    font-size: 30rpx;
    line-height: 113rpx;
    border-radius: 10rpx 10rpx 10rpx 10rpx;
  }
</style>
